package org.dtrd.config.common;

/**
 * H5与小程序、服务器
 *
 * @author xiao
 * @date 2022/8/1 11:11 AM
 */
public class PathUtil {

    private static String h5Path;
    private static String orgDetailUrl;
    private static String chatroomUrl;
    private static String apiRootUrl;

    private static final String CLIENT = "CLIENT";
    private static final String USERID = "USERID";
    private static final String ROOMID = "ROOMID";

    public static String getH5Domain() {
        return h5Path;
    }

    public static void setH5Domain(String h5Path) {
        PathUtil.h5Path = h5Path;
    }

    public static String getChatroomUrl(String client, String userId, String chatroomId) {
        return chatroomUrl.replace(CLIENT, client).replace(USERID, userId).replace(ROOMID, chatroomId);
    }

    public static String getOrgDetailUrl(String orgCode) {
        if (orgDetailUrl != null) {
            return h5Path+orgDetailUrl + orgCode;
        }
        return null;
    }

    public static void setChatroomUrl(String chatroomUrl) {
        PathUtil.chatroomUrl = chatroomUrl;
    }

    public static String getApiRootUrl() {
        return apiRootUrl;
    }

    public static void setApiRootUrl(String apiRootUrl) {
        PathUtil.apiRootUrl = apiRootUrl;
    }


    public static void setOrgDetailUrl(String orgDetailUrl) {
        PathUtil.orgDetailUrl=orgDetailUrl;
    }
}
